package com.cy.action.backuser;

import java.util.ArrayList;
import java.util.List;

import com.cy.common.BaseAction;
import com.cy.entity.BackPurview;
import com.cy.service.BackPurviewService;

public class BackPurviewManageAction extends BaseAction{
	
	private static final long serialVersionUID = -5466900357631757366L;

	private BackPurviewService backPurviewService;
	
	private String parentPurviewId;						
	private String parentPurviewName;					//用于显示父级权限
	private BackPurview backPurview;					
	
	private String backPurviewId;						//用于修改权限
	
	private String control;								//用户判断操作
	
	private List<BackPurview> bpLevelIs;
	private List<BackPurview> bpLevelIIs;
	
	public String execute() {
		bpLevelIs=backPurviewService.listBackPurviewByLevel(0);
		bpLevelIIs=new ArrayList<BackPurview>();
		for(BackPurview backPurview:bpLevelIs){
			bpLevelIIs.addAll(backPurviewService.listBackPurviewByParent(backPurview.getId()));
		}
		
		return SUCCESS;
	}
	
	public String addNewPurview(){
		return SUCCESS;
	}
	
	public String editNewPurview(){
		control="EDIT";
		backPurview=(BackPurview) backPurviewService.getObject(Long.parseLong(backPurviewId));
		return SUCCESS;
	}

	public String getParentPurviewId() {
		return parentPurviewId;
	}

	public void setParentPurviewId(String parentPurviewId) {
		this.parentPurviewId = parentPurviewId;
	}

	public BackPurview getBackPurview() {
		return backPurview;
	}

	public void setBackPurview(BackPurview backPurview) {
		this.backPurview = backPurview;
	}

	public BackPurviewService getBackPurviewService() {
		return backPurviewService;
	}

	public void setBackPurviewService(BackPurviewService backPurviewService) {
		this.backPurviewService = backPurviewService;
	}

	public List<BackPurview> getBpLevelIs() {
		return bpLevelIs;
	}

	public void setBpLevelIs(List<BackPurview> bpLevelIs) {
		this.bpLevelIs = bpLevelIs;
	}

	public String getParentPurviewName() {
		return parentPurviewName;
	}

	public void setParentPurviewName(String parentPurviewName) {
		this.parentPurviewName = parentPurviewName;
	}

	public List<BackPurview> getBpLevelIIs() {
		return bpLevelIIs;
	}

	public void setBpLevelIIs(List<BackPurview> bpLevelIIs) {
		this.bpLevelIIs = bpLevelIIs;
	}

	public String getBackPurviewId() {
		return backPurviewId;
	}

	public void setBackPurviewId(String backPurviewId) {
		this.backPurviewId = backPurviewId;
	}

	public String getControl() {
		return control;
	}

	public void setControl(String control) {
		this.control = control;
	}

	
	
	

	
	

}
